
# for request dispatch


class ErrorInDispatch():
    def error_in_dispatch(self, request, response, *args, **kwargs):
        self.args = args
        self.kwargs = kwargs
        request = self.initialize_request(request, *args, **kwargs)
        self.request = request
        self.headers = self.default_response_headers  # deprecate?
        self.response = self.finalize_response(
            request,
            response,
            *args, **kwargs
        )
        return self.response
